import Vue from 'vue'
import VueRouter from 'vue-router'
import Discover from '../views/discover/Discover'
import My from '../views/my/My'
import Friend from '../views/friend/Friend'
//二级路由===发现页
import Album from '../views/discover/Album.vue'
import ArtList from '../views/discover/ArtList.vue'
import DJRadio from '../views/discover/DJRadio.vue'
import PlayList from '../views/discover/PlayList.vue'
import Recommend from '../views/discover/Recommend.vue'
import TopList from '../views/discover/TopList.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    //重定向（用户访问 当前用户 自动的切换到 重定向的目标路由）
    redirect:'/discover',
  },
  {
    path: '/discover',
    component: Discover,
    /**重定向到某一个子路由： 打开这个  重新打开 /discover/recommend  */
    redirect:'/discover/recommend',
    children: [
      {
        path: '/discover/recommend',
        component: Recommend
      },
      {
        path: '/discover/album',
        component: Album
      },
      {
        path: '/discover/artList',
        component: ArtList
      },
      {
        path: '/discover/djradio',
        component: DJRadio
      },
      {
        path: '/discover/playList',
        component: PlayList
      },
      {
        path: '/discover/toplist',
        component: TopList
      }
    ]
  },
  {
    path: '/my',
    component: My
  },
  {
    path: '/friend',
    component: Friend
  }
  
]

const router = new VueRouter({
  routes
})

export default router
